import axios from 'axios'
const baseUrl = "http://www.lovegf.cn:8899"
axios.defaults.baseURL = baseUrl

//轮播图
export const getlunbot = () => {
    return axios.get('/api/getlunbo').then(res => res.data)
}

//新闻列表
export const getnew = () => {
    return axios.get('/api/getnewslist').then(res => res.data)
}

//新闻详情
export const getinfo = params => {
    return axios.get(`/api/getnew/${params}`).then(res => res.data)
}

//评论获取
export const getcommit = params => {
    return axios.get(`/api/getcomments/${params.id}?pageindex=${params.pageindex}`).then(res => res.data)
}

//添加评论
export const addcommit = params => {
    return axios.post(`/api/postcomment/${params.id}`, { content: params.content }).then(res => res.data)
}

//获取头部分类
export const getcate = () => {
    return axios.get('/api/getimgcategory').then(res => res.data)
}

//获取图片
export const getpic = params => {
    return axios.get(`/api/getimages/${params.cateid}`).then(res => res.data)
}

//获取图片详情信息
export const getpicinfo = params => {
    return axios.get(`/api/getimageInfo/${params.imgid}`).then(res => res.data)
}

//获取缩略图
export const getpto = params => {
    return axios.get(`/api/getthumimages/${params.imgid}`).then(res => res.data)
}

//商品列表
export const getgoodlist = params => {
    return axios.get('/api/getgoods?pageindex=' + params).then(res => res.data)
}

//商品详情轮播图
export const getlunbo = params => {
    return axios.get(`/api/getthumimages/${params.imgid}`).then(res => res.data)
}

//商品详情
export const getgoodinfo = params => {
    return axios.get(`/api/goods/getinfo/${params.id}`).then(res => res.data)
}

//商品图文介绍
export const goodsdec = params => {
        return axios.get(`/api/goods/getdesc/${params}`).then(res => res.data)
    }
    //获得购物车列表
export const getgoodslist = params => {
    return axios.get(`/api/goods/getshopcarlist/${params}`).then(res => res.data)
}